//手机号验证
export function phoneRex(rule, value, callback) {
  let testPhone = /^(?=.*\d)[a-z\d]{4,20}$/i;
  //
  if (!testPhone.test(value)) {
    callback(new Error("Wrong mobile phone number input."));
  }else{
    callback()
  }
};
export  function emailRule (rule, value, callback){
  var regEmail =/^[a-zA-Z0-9_-]+@([a-zA-Z0-9]+\.)+(com|cn|net|org)$/;
    if (value === "") {
      callback(new Error('Email is required.'))
    } else {
      if (!regEmail.test(value)) {
        callback(new Error("Please enter your real email address"));
      }else{
        callback()
      }
    }
}
// 
export  function stringRule (rule, value, callback){
  var regString = /^[\u4e00-\u9fa5_a-zA-Z0-9]+$/;
    if (value === "") {
      callback(new Error("请输入姓名"));
    } else {
      if (!regString.test(value)) {
        callback(new Error("禁止输入特殊字符及空格"));
      }else{
        callback()
      }
    }
}